home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2003 December / The Sunday Times - The Month 2003-12.iso / pc / engine / shell / shell.swf / scripts / frame_3 / DoAction_2.as next >
Encoding:
Text File  |  2003-11-10  |  13.6 KB  |  638 lines

  1. function makeButtonShield()
  2. {
  3.    var clp = this.createEmptyMovieClip("mc_button_shield",Tardis.depth++);
  4.    var clpHA = clp.createEmptyMovieClip("mc_hitarea",Tardis.depth++);
  5.    var w = 250;
  6.    var h = 50;
  7.    clpHA.moveTo(0,0);
  8.    clpHA.beginFill(16711680);
  9.    clpHA.lineTo(w,0);
  10.    clpHA.lineTo(w,h);
  11.    clpHA.lineTo(0,h);
  12.    clpHA.lineTo(0,0);
  13.    clpHA.endFill();
  14.    clp._x = _xmouse - w / 2;
  15.    clp._y = _ymouse - h / 2;
  16.    clp.hitArea = clpHA;
  17.    clp.onRollOut = function()
  18.    {
  19.       this.mc_hitarea.removeMovieClip();
  20.       this.removeMovieClip();
  21.    };
  22.    clpHA._visible = false;
  23. }
  24. function splashRestart()
  25. {
  26.    if(ActiveSection == null || overlay.active == true)
  27.    {
  28.       return undefined;
  29.    }
  30.    LastSection = ActiveSection;
  31.    ActiveSection = null;
  32.    bottomNav.show();
  33.    bottomNav.clearActive();
  34.    bottomNav.fadeOthers("","up");
  35.    footer.sponsorButtonShow();
  36.    if(ActiveItem != null)
  37.    {
  38.       LastItem = ActiveItem;
  39.       itemExit();
  40.    }
  41.    else if(LastSection.type == "bespoke")
  42.    {
  43.       itemExit();
  44.    }
  45.    header.clearUp();
  46. }
  47. function webPageOpen(strURL)
  48. {
  49.    if(PLAY_MODE == "browser")
  50.    {
  51.       getURL(strURL,"");
  52.    }
  53.    else if(ActiveSection.confirmweb != null)
  54.    {
  55.       lingo("Flsh_openWebPageConfirm(\"" + strURL + "\")");
  56.    }
  57.    else
  58.    {
  59.       lingo("Flsh_openWebPage(\"" + strURL + "\")");
  60.    }
  61. }
  62. function sectionGo()
  63. {
  64.    if(splash.blnAtStart == true)
  65.    {
  66.       delete splash.blnAtStart;
  67.       header.go(ActiveSection.id);
  68.       sectionLoad();
  69.    }
  70.    else
  71.    {
  72.       sectionLoad();
  73.    }
  74. }
  75. function sectionLoad()
  76. {
  77.    LastSection = null;
  78.    var strID = ActiveSection.id;
  79.    if(ActiveSection.type == "bespoke")
  80.    {
  81.       template.loadBespokeSection();
  82.       UsageData.addPageEntry(ActiveSection.index);
  83.       header.go(ActiveSection.id);
  84.    }
  85.    else
  86.    {
  87.       sideMenu.onComplete = function()
  88.       {
  89.          delete this.onComplete;
  90.          template.loadModules();
  91.       };
  92.       template.onDataLoaded = function()
  93.       {
  94.          delete this.onDataLoaded;
  95.          this.loadModules();
  96.       };
  97.       sideMenu.onReady = function()
  98.       {
  99.          this._visible = true;
  100.          this.onReady = null;
  101.          if(Shortcut != null)
  102.          {
  103.             header.go(ActiveSection.id);
  104.             Tardis.ActiveItem = this.ItemHome.byPath(Shortcut);
  105.             if(Tardis.ActiveItem == null)
  106.             {
  107.                Tardis.ActiveItem = this.ItemHome;
  108.             }
  109.             this.makeChildren(Tardis.ActiveItem);
  110.             Tardis.itemLoad();
  111.             delete Shortcut;
  112.          }
  113.          else if(Tardis.ActiveItem == null)
  114.          {
  115.             Tardis.ActiveItem = this.ItemHome;
  116.             Tardis.itemLoad();
  117.          }
  118.       };
  119.       sideMenu.make(strID);
  120.    }
  121.    if(ActiveSection.hideSponsor == "true")
  122.    {
  123.       footer.sponsorButtonHide();
  124.    }
  125.    else
  126.    {
  127.       footer.sponsorButtonShow();
  128.    }
  129. }
  130. function sectionExit()
  131. {
  132.    ActiveItem = null;
  133.    LastItem = null;
  134.    sideMenu.clearUp();
  135.    adverts.clearUp();
  136.    if(Shortcut != null)
  137.    {
  138.       sectionLoad();
  139.    }
  140.    else if(ActiveSection != null)
  141.    {
  142.       sectionGo();
  143.    }
  144.    else
  145.    {
  146.       splash.show();
  147.       splash.restart();
  148.    }
  149. }
  150. function itemJump(nmSection, strPath)
  151. {
  152.    splash.interrupted = false;
  153.    var objSectionNew = Sections.item(nmSection);
  154.    if(overlay.active == true)
  155.    {
  156.       template.onReady = function()
  157.       {
  158.          Tardis.overlay.close();
  159.          this.onReady = null;
  160.       };
  161.    }
  162.    if(objSectionNew != ActiveSection)
  163.    {
  164.       LastSection = ActiveSection;
  165.       ActiveSection = objSectionNew;
  166.       Shortcut = strPath;
  167.       bottomNav.setActive(ActiveSection.id);
  168.       if(LastSection == null)
  169.       {
  170.          sectionLoad();
  171.       }
  172.       else
  173.       {
  174.          itemExit();
  175.       }
  176.    }
  177.    else
  178.    {
  179.       ActiveItem = sideMenu.ItemHome.byPath(strPath);
  180.       sideMenu.makeChildren(ActiveItem);
  181.       itemLoad();
  182.    }
  183. }
  184. function itemGo(Item)
  185. {
  186.    switch(Item.attributes.type)
  187.    {
  188.       case "html":
  189.          if(Childlock.active == true)
  190.          {
  191.             return undefined;
  192.          }
  193.          var strURL = Item.attributes.local != "true" ? "" : "assets/html/";
  194.          strURL += Item.attributes.file;
  195.          webPageOpen(strURL);
  196.          itemLog(Item);
  197.          break;
  198.       case "lock":
  199.          if(Childlock.active != true)
  200.          {
  201.             Childlock.lockDialog();
  202.          }
  203.          else
  204.          {
  205.             Childlock.unlockDialog();
  206.          }
  207.          break;
  208.       case "app":
  209.          itemLog(Item);
  210.          break;
  211.       case "shortcut":
  212.          itemJump(Item.attributes.section,Item.attributes.itemref);
  213.          break;
  214.       case "promo":
  215.          overlay.showPromo(ASSETS_FOLDER + "promos/" + Item.attributes.file);
  216.          break;
  217.       default:
  218.          break;
  219.       case "template":
  220.       case "bespoke":
  221.          LastItem = ActiveItem;
  222.          ActiveItem = Item;
  223.          if(LastItem != null)
  224.          {
  225.             itemExit();
  226.          }
  227.          else
  228.          {
  229.             itemLoad();
  230.          }
  231.          return true;
  232.    }
  233. }
  234. function itemLoad()
  235. {
  236.    sideMenu.onComplete = function()
  237.    {
  238.       delete this.onComplete;
  239.       template.loadModules();
  240.    };
  241.    template.onDataLoaded = function()
  242.    {
  243.       delete this.onDataLoaded;
  244.       this.loadModules();
  245.    };
  246.    if(ActiveSection.hideSponsor != "true" || ActiveItem.attributes.hideSponsor == "false")
  247.    {
  248.       footer.sponsorButtonShow();
  249.    }
  250.    else
  251.    {
  252.       footer.sponsorButtonHide();
  253.    }
  254.    template.load();
  255.    itemLog(ActiveItem);
  256. }
  257. function loadAdvertButton()
  258. {
  259.    var item_advert = ActiveItem.attributes.advert;
  260.    var advert_id = item_advert != null ? item_advert : ActiveSection.advert;
  261.    if(advert_id != adverts.strPlaylistID)
  262.    {
  263.       adverts.prepare(advert_id);
  264.    }
  265. }
  266. function itemExit()
  267. {
  268.    template.exit();
  269. }
  270. function itemHide()
  271. {
  272.    if(ActiveItem.attributes.type === "template")
  273.    {
  274.       template.hide();
  275.    }
  276. }
  277. function itemShow()
  278. {
  279.    if(ActiveItem.attributes.type === "template")
  280.    {
  281.       template.show();
  282.    }
  283. }
  284. function itemLog(Item)
  285. {
  286.    var str = ActiveSection.index;
  287.    if(Item != sideMenu.ItemHome)
  288.    {
  289.       str += sideMenu.arrParentIndex.length <= 0 ? "" : "." + sideMenu.arrParentIndex.join(".");
  290.       str += Item.firstChild.hasChildNodes() == true ? "" : "." + Item.index;
  291.    }
  292.    Tardis.UsageData.addPageEntry(str);
  293. }
  294. function onItemExit()
  295. {
  296.    if(LastSection != null)
  297.    {
  298.       LastSection = null;
  299.       sectionExit();
  300.    }
  301.    else
  302.    {
  303.       itemLoad();
  304.    }
  305. }
  306. function maskShow()
  307. {
  308.    this.attachMovie("clp_fullscreen_mask","mask",Tardis.depth++);
  309.    eval("interface").disable();
  310. }
  311. function maskHide()
  312. {
  313.    mask.removeMovieClip();
  314.    eval("interface").enable();
  315. }
  316. overlay = {};
  317. overlay.showAdvert = function(file)
  318. {
  319.    if(this.active == true)
  320.    {
  321.       this.onClosed = function()
  322.       {
  323.          this.showAdvert(this.next_file);
  324.          delete this.onClosed;
  325.          delete this.next_file;
  326.       };
  327.       this.next_file = file;
  328.       this.close();
  329.    }
  330.    this.__type = "advert";
  331.    this.show(file);
  332. };
  333. overlay.showPromo = function(file)
  334. {
  335.    if(this.active == true)
  336.    {
  337.       this.onClosed = function()
  338.       {
  339.          this.showPromo(this.next_file);
  340.          delete this.onClosed;
  341.          delete this.next_file;
  342.       };
  343.       this.next_file = file;
  344.       this.close();
  345.    }
  346.    this.__type = "promo";
  347.    this.show(file);
  348. };
  349. overlay.showPanel = function(file, blnAsset)
  350. {
  351.    if(this.active == true)
  352.    {
  353.       this.onClosed = function()
  354.       {
  355.          this.showPanel(this.next_file);
  356.          delete this.onClosed;
  357.          delete this.next_file;
  358.       };
  359.       this.next_file = file;
  360.       this.close();
  361.    }
  362.    this.__asset = blnAsset != true ? false : true;
  363.    this.__type = "panel";
  364.    this.show(file);
  365. };
  366. overlay.showIntro = function(file)
  367. {
  368.    if(this.active == true)
  369.    {
  370.       this.onClosed = function()
  371.       {
  372.          trace("INTRO CLOSED");
  373.          this.showPanel(this.next_file);
  374.          delete this.onClosed;
  375.          delete this.next_file;
  376.       };
  377.       this.next_file = file;
  378.       this.close();
  379.    }
  380.    this.__type = "intro";
  381.    this.show(file);
  382. };
  383. overlay.show = function(file)
  384. {
  385.    this.active = true;
  386.    if(this.__type == "advert")
  387.    {
  388.       lingo("spriteOverlay.show(\"" + file + "\")");
  389.    }
  390.    else
  391.    {
  392.       this.file = file;
  393.    }
  394.    this.showBuild();
  395. };
  396. overlay.loadPanel = function()
  397. {
  398.    Tardis.createEmptyMovieClip("mc_panel",++Tardis.depth);
  399.    var strFile;
  400.    switch(this.__type)
  401.    {
  402.       case "panel":
  403.          strFile = (!this.__asset ? Tardis.ENGINE_FOLDER : Tardis.ASSETS_FOLDER) + "panels/" + this.file + ".swf";
  404.          break;
  405.       case "promo":
  406.          strFile = this.file;
  407.          break;
  408.       case "intro":
  409.          strFile = Tardis.ASSETS_FOLDER + this.file;
  410.          break;
  411.       default:
  412.          error("overlay : loadPanel : type not recognised : " + this.__type);
  413.    }
  414.    with(Tardis.mc_panel)
  415.    {
  416.       loadMovie(strFile);
  417.       _x = 15;
  418.       _y = 112;
  419.    }
  420. };
  421. overlay.showBuild = function()
  422. {
  423.    lingo("spriteVideo.show(FALSE)");
  424.    lingo("bespoke_show(FALSE)");
  425.    if(this.file === "help")
  426.    {
  427.       header.go(this.file);
  428.    }
  429.    splash.interrupt();
  430.    splash.hide();
  431.    if(ActiveSection == null && intro == null)
  432.    {
  433.       splash.endSoundLoop();
  434.    }
  435.    else if(ActiveSection.sandbox == "true")
  436.    {
  437.       template.exit();
  438.    }
  439.    else
  440.    {
  441.       itemHide();
  442.    }
  443.    eval("interface").disable();
  444.    intro.onTransitionEnd();
  445.    switch(this.__type)
  446.    {
  447.       case "advert":
  448.          if(intro == null)
  449.          {
  450.             closeButton.show("advert");
  451.          }
  452.          lingo("spriteOverlay.buildFinished()");
  453.          break;
  454.       case "promo":
  455.          closeButton.show("promo");
  456.          overlay.loadPanel();
  457.          break;
  458.       default:
  459.          if(intro != null)
  460.          {
  461.          }
  462.          closeButton.show(Tardis.overlay.file);
  463.          overlay.loadPanel();
  464.    }
  465. };
  466. overlay.close = function()
  467. {
  468.    if(this.active != true)
  469.    {
  470.       return undefined;
  471.    }
  472.    if(ActiveSection == null)
  473.    {
  474.       header.clearUp();
  475.       splash.startSoundLoop();
  476.    }
  477.    else if(ActiveSection.sandbox != "true")
  478.    {
  479.       if(ActiveSection == "credits")
  480.       {
  481.          Tardis.mc_credits.startCountdown();
  482.       }
  483.       else
  484.       {
  485.          header.go(ActiveSection.id);
  486.       }
  487.    }
  488.    closeButton.hide();
  489.    makeButtonShield();
  490.    eval("interface").enable();
  491.    bottomNav.enable();
  492.    if(intro == null)
  493.    {
  494.       if(ActiveSection == null)
  495.       {
  496.          splash.show();
  497.          splash.restartSection();
  498.       }
  499.       else
  500.       {
  501.          if(splash.interrupted == true)
  502.          {
  503.             splash.resume();
  504.          }
  505.          else if(ActiveItem == null)
  506.          {
  507.             sectionLoad();
  508.          }
  509.          else
  510.          {
  511.             itemShow();
  512.          }
  513.          splash.endSoundLoop();
  514.       }
  515.    }
  516.    else
  517.    {
  518.       intro._visible = true;
  519.    }
  520.    lingo("bespoke_show(TRUE)");
  521.    lingo("spriteVideo.show(TRUE)");
  522.    if(this.__type == "advert")
  523.    {
  524.       lingo("spriteOverlay.close()");
  525.    }
  526.    else
  527.    {
  528.       mc_panel.unloadMovie();
  529.       delete mc_panel;
  530.       Tardis.footer.buttonReset(this.file);
  531.    }
  532.    delete this.file;
  533.    this.active = false;
  534.    if(ActiveSection.sandbox == "true")
  535.    {
  536.       splashRestart();
  537.    }
  538.    overlay.onClosed();
  539. };
  540. bottomNav.onOver = function(strID)
  541. {
  542.    with(Tardis)
  543.    {
  544.       SFX.play("NavOver");
  545.       if(ActiveSection == null)
  546.       {
  547.          splash.pauseAt(strID);
  548.       }
  549.    }
  550. };
  551. bottomNav.onOut = function()
  552. {
  553.    with(Tardis)
  554.    {
  555.       if(ActiveSection == null)
  556.       {
  557.          splash.resume();
  558.       }
  559.    }
  560. };
  561. bottomNav.onUp = function(strID)
  562. {
  563.    with(Tardis)
  564.    {
  565.       if(splash.onAnimationEnd != null && ActiveSection != null)
  566.       {
  567.          bottomNav.setActive(ActiveSection.id);
  568.          return undefined;
  569.       }
  570.       SFX.play("NavClick");
  571.       var blnAtFirstSplash = ActiveSection == null;
  572.       LastSection = ActiveSection;
  573.       ActiveSection = Tardis.Sections[strID];
  574.       if(blnAtFirstSplash)
  575.       {
  576.          if(PLAY_MODE != "browser")
  577.          {
  578.             splash.onAnimationEnd = function()
  579.             {
  580.                this.endSoundLoop();
  581.                this.onAnimationEnd = null;
  582.                this.clearUp();
  583.                this.blnAtStart = true;
  584.                Tardis.sectionGo();
  585.             };
  586.             splash.resume();
  587.          }
  588.          else
  589.          {
  590.             mc_browser_msg.unloadMovie();
  591.             splash.blnAtStart = true;
  592.          }
  593.       }
  594.       else if(strID != LastSection.id)
  595.       {
  596.          if(LastSection.type != "bespoke")
  597.          {
  598.             LastItem = ActiveItem;
  599.          }
  600.          header.go(strID);
  601.          itemExit();
  602.       }
  603.       else
  604.       {
  605.          if(LastSection.type != "bespoke")
  606.          {
  607.             if(ActiveItem != sideMenu.ItemHome)
  608.             {
  609.                itemGo(sideMenu.ItemHome);
  610.             }
  611.          }
  612.          LastSection = null;
  613.       }
  614.    }
  615. };
  616. set("interface",{});
  617. eval("interface").setEnabled = function(val)
  618. {
  619.    bottomNav._visible = val;
  620.    if(sideMenu.active)
  621.    {
  622.       sideMenu._visible = val;
  623.    }
  624.    if(adverts.enabled == true)
  625.    {
  626.       !val ? adverts.interrupt() : adverts.resume();
  627.    }
  628.    adverts._visible = val;
  629. };
  630. eval("interface").enable = function()
  631. {
  632.    eval("interface").setEnabled(true);
  633. };
  634. eval("interface").disable = function()
  635. {
  636.    eval("interface").setEnabled(false);
  637. };
  638.